package com.tanhua.server.task;

import com.tanhua.commons.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;

@Component
public class RemainingTimesTask {
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @Scheduled(cron = "0 0 0 */1 * ? ")
    public void remainingTimes() throws ParseException {
        String redisKey =  DateUtils.getRanmdomDaysAgo(0)+"_Peach_Chance";
        redisTemplate.opsForValue().set(redisKey,"8");
        System.out.println("RemainingTimesTask has finished");
    }
}
